<?php
namespace Home\Model;
use Think\Model;

class IndexModel extends Model {
	//把用户的openid写入数据库 用户扫码关注时做的，控制器是index
	public function putUserData($openid){
		$user = M("User");
		$data['openid'] = $openid;
		//默认刚关注为以及
		$data['score']  = '1';
		//如果已经有记录了
		if($user->select($openid)){
			return 1;
		}
		return $user->add($data);
	}   
}